//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    internal class Backdrop: IOfficeXmlSerializable
    {
        private Point3D anchor;
        private Vector3D norm;
        private Vector3D up;
        private OfficeArtExtensionList extLst;
        internal const string xmlName = "backdrop";

        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read(xmlName))
            {
                this.anchor = c.ReadElementAs<Point3D>("anchor");
                this.norm = c.ReadElementAs<Vector3D>("norm");
                this.up = c.ReadElementAs<Vector3D>("up");
                extLst = c.ReadOptionalElement<OfficeArtExtensionList>(OfficeArtExtensionList.xmlName);
            }
        }

        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write(xmlName))
            {
                c.WriteElementAs(anchor, "anchor");
                c.WriteElementAs(norm, "norm");
                c.WriteElementAs(up, "up" );
                c.WriteOptionalElement(extLst );
            }
        }
    }
}